package org.fing.edu.uy.admin.managedBean;

import java.io.Serializable;
import java.net.InetAddress;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

@ApplicationScoped
@ManagedBean(name="applicationController")
public class ApplicationController implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private String hostName;
	
	@PostConstruct
	public void init(){
		try{
			InetAddress addr = InetAddress.getLocalHost();
			hostName = addr.getHostName();
		}catch (Exception ex) {
			Logger.getLogger(this.getClass().getSimpleName()).log(Level.SEVERE, "Error when initialized application bean. See Trace.", ex);
		}
	}

	public String getHostName() {
		return hostName;
	}

	public void setHostName(String hostName) {
		this.hostName = hostName;
	}
	
}
